import React, { Component } from 'react';
import axios from 'axios';

import './index.scss'
class MingPin extends Component {
  constructor(props){
    super(props)
    this.state = {
      shoplist : []
    }

  }
  componentWillMount() {
    axios.get('./3.json').then((response) => {
      var result = response.data;
      // console.log(response.data);
      this.setState({
        shoplist : result
      })
    })
  }
  render() {
    let shoplist = this.state.shoplist;
    console.log(shoplist);
    return (
      <div className="mingpin">
        <div className="list-items">
          <ul className="tuan-list">
          {
            shoplist.map((item,index) => {
              return(
                <li key={index}>
                <a href="http://www.baidu.com" className="clearfix">
                  <div className="list-img">
                    <img src={item.image_url_set.main['320']} alt=""/>
                    <span className="list-img-manjian">{item.discount_string}</span>
                  </div>
                  <div className="list-info">
                    <h2>{item.title}</h2>
                    <span>仅剩03天14小时00分</span>
                  </div>
                  <div className="list-logo">
                    <img src={item.image_url_set.brand['320']} alt=""/>
                  </div>
                </a>
              </li>
              )
            })
            }
          </ul>
        </div>
      </div>
    );
  }
}

export default MingPin;
